home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2001 June
/
PCWorld_2001-06_cd.bin
/
Novinky
/
unis
/
Soubory ExcelDB.exe
/
ExcelDB
/
Seçity
/
SQLSERVERMAKRO.bas
< prev
next >
Wrap
BASIC Source File
|
2001-04-24
|
1KB
|
34 lines
Attribute VB_Name = "Module1"
Sub Makro1()
Attribute Makro1.VB_Description = "Makro zaznamenanΘ 13.4.2001, Pokorn²"
Attribute Makro1.VB_ProcData.VB_Invoke_Func = " \n14"
'
' Makro1 Makro
' Makro zaznamenanΘ 13.4.2001, Pokorn²
'
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DRIVER=SQL Server;SERVER=(local);UID=sa;PWD=;WSID=X8J5U8;DATABASE=Northwind" _
, Destination:=Range("A11"))
.CommandText = Array( _
"SELECT Customers.CustomerID, Customers.CompanyName, Customers.Address, Customers.City, Customers.Country, Orders.OrderID, Orders.OrderDate, Orders.Freight" & Chr(13) & "" & Chr(10) & "FROM Northwind.dbo.Customers Customers, Nort" _
, _
"hwind.dbo.Orders Orders" & Chr(13) & "" & Chr(10) & "WHERE Customers.CustomerID = Orders.CustomerID AND ((Customers.Country='USA') OR (Customers.Country='Canada') OR (Customers.Country='Mexico'))" & Chr(13) & "" & Chr(10) & "ORDER BY Customers.CompanyName" _
)
.Name = "Dotaz z SQL Server"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
End Sub